home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Archive-tools
/
untar and compress Folder
/
compress
/
(compress.original)
/
compress.1
next >
Wrap
Text File
|
1993-03-12
|
6KB
|
265 lines
.PU
.TH COMPRESS 1 local
.SH NAME
compress, uncompress, zcat \- compress and uncompress files
.SH SYNOPSIS
.ll +8
.B compress
[
.B \-c
] [
.B \-C
] [
.B \-d
] [
.B \-f
] [
.B \-v
] [
.B \-b
.I bits
] [
.I "filename \&..."
]
.ll -8
.br
.B uncompress
[
.B \-c
] [
.B \-f
] [
.B \-v
] [
.B \-V
] [
.I "filename \&..."
]
.br
.B zcat
[
.I "filename \&..."
]
.SH DESCRIPTION
Compresses the specified files or standard input.
Each file is replaced by a file with the extension
.B "\&.Z,"
but only if the file got smaller.
If no files are specified,
the compression is applied to the standard input
and is written to standard output
regardless of the results.
Compressed files can be restored
to their original form by specifying the
.B \-d
option, or by running
.I uncompress
(linked to
.IR compress ),
on the
.B "\&.Z"
files or the standard input.
.PP
If the output file exists, it will not be overwritten unless the
.B \-f
flag is given. If
.B \-f
is not specified and
.I compress
is run in the foreground,
the user is prompted
as to whether the file should be overwritten.
.PP
If the
.B \-f
flag is given, all files specified are replaced with
.B "\&.Z"
files \- even if the file didn't get smaller.
.PP
When file names are given, the ownership (if run by root), modes, accessed
and modified times are maintained between the file and its
.B "\&.Z"
version. In this respect,
.I compress
can be used for archival purposes, yet can still be used with
.IR make "(1)"
after uncompression.
.PP
The
.B \-c
option causes the results of the compress/uncompress operation to be written
to stdout; no files are changed. The
.I zcat
program is the same as specifying
.B \-c
to
.I uncompress
(all files are unpacked and written to stdout).
.PP
.I Compress
uses the modified Lempel-Ziv algorithm described in
"A Technique for High Performance Data Compression",
Terry A. Welch,
.I "IEEE Computer"
Vol 17, No 6 (June 1984), pp 8-19.
Common substrings in the file are first replaced by 9-bit codes 257 and up.
When code 512 is reached, the algorithm switches to 10-bit codes and
continues to use more bits until the
.I bits
limit as specified by the
.B \-b
flag is reached (default 16).
.I Bits
must be between 9 and 16. The default can be changed in the source to allow
.I compress
to be run on a smaller machine.
.PP
After the
.I bits
limit is reached,
.I compress
periodically checks the compression ratio. If it is increasing,
.I compress
continues to use the codes that were previously found in the file. However,
if the compression ratio decreases,
.I compress
discards the table of substrings and rebuilds it from scratch. This allows
the algorithm to adapt to the next "block" of the file. The
.B \-C
(compatibility) flag prevents subdivision of the file into blocks;
this produces an output file that old versions of
.I compress
can read.
.PP
A two byte magic number is prepended to the file
to ensure that neither uncompression of random text nor recompression of
compressed text are attempted. In addition, the
.I bits
specified during
.I compress
is written to the file so that the
.B \-b
flag can be omitted for
.IR uncompress \.
.PP
.ne 8
The amount of compression obtained depends on the size of the
input file, the amount of
.I bits
per code, and the distribution of character substrings.
Typically, text files, such as C programs,
are reduced by 50\-60%.
Compression is generally much better than that achieved by
Huffman coding (as used in
.IR pack ),
or adaptive Huffman coding
.RI ( compact ),
and takes less time to compute.
.PP
.PP
If the
.B \-v
(verbose) flag is given, then
after each file is compressed, a message is printed giving the percentage of
the input file that has been saved by compression.
.PP
If the
.B \-V
(version) flag is given, the program's version number is printed.
.PP
The exit status is normally 0;
if the last file gets bigger after compression, the exit status is 2;
if an error occurs, the exit status is 1.
.SH "SEE ALSO"
compact(1), pack(1)
.SH "DIAGNOSTICS"
Usage: compress [-cCdfvV] [-b maxbits] [file ...]
.in +8
Invalid options were specified on the command line.
.in -8
Missing maxbits
.in +8
Maxbits must follow
.BR \-b \.
.in -8
Unknown flag:
.I "\'x\';"
.in +8
Invalid flags were specified on the command line.
.in -8
.IR file :
not in compressed format
.in +8
The specified file has not been compressed.
.in -8
.IR file :
compressed with
.I xx
bits, can only handle
.I yy
bits
.in +8
The specified file was compressed by a compress program that could handle
more
.I bits
than the current compress program. Recompress the file with a smaller
.IR bits \.
.in -8
.IR file :
already has .Z suffix -- no change
.in +8
Cannot compress a file that has a ".Z" suffix.
.IR mv "(1)"
the file to a different name and try again.
.in -8
.IR file :
filename too long to tack on .Z
.in +8
The specified file cannot be compressed because its filename is longer than
12 characters.
.IR mv "(1)"
the file to a different name and try again. This message does not occur on
4.2BSD systems.
.in -8
.I file
already exists; do you wish to overwrite (y or n)?
.in +8
Respond "y" if you want the output file to be replaced; "n" if you want it
to be left alone.
.in -8
.IR file :
.in +8
This message fragment is written during the processing of a file.
.in -8
Compression:
.I "xx.xx%"
.in +8
This message fragment gives the percentage of the input file that has been
saved by compression.
.in -8
-- not a regular file: unchanged
.in +8
This message fragment is written when the input file is not a regular file.
The input file is left unchanged.
.in -8
-- has
.I xx
other links: unchanged
.in +8
This message fragment is written when the input file has links. The input
file is left unchanged. See
.IR ln "(1)"
for more information.
.in -8
-- file unchanged
.in +8
This message fragment is written when no savings are achieved by
compression. The input file is left unchanged.
.in -8
-- replaced with
.I file
.in +8
This message fragment is written when a file has been sucessfully
compressed/uncompressed.
.in -8